package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_ElectronicTicketStateRecord 电子券状态
 *
 */
public class TestData_TB_ElectronicTicketStateRecord
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ElectronicTicketStateRecord saveMust(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ElectronicTicketStateRecord");
		return (TB_ElectronicTicketStateRecord)repository.save(newMust(
				electronicTicket
			));
	}
	
	public static TB_ElectronicTicketStateRecord newMust(
		bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket
	){
		return new TB_ElectronicTicketStateRecord(new TB_ElectronicTicketStateRecord.MustProperties() {
			/** 类型 */
			@Override public bairui.international.model.type.Type_StateRecord getType(){
				return bairui.international.model.type.Type_StateRecord.Flow;
			}
			/** 说明 */
			@Override public String getCommentate(){
				return Generator.generate(0, 255);
			}
			/** 电子券 */
			@Override public bairui.international.model.domain.jpa.TB_ElectronicTicket getElectronicTicket(){
				return electronicTicket;
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ElectronicTicketStateRecord saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ElectronicTicketStateRecord");
		return (TB_ElectronicTicketStateRecord)repository.save(newAll(
				electronicTicket
			));
	}
	
	public static TB_ElectronicTicketStateRecord newAll(
		bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket
	){
		return new TB_ElectronicTicketStateRecord(
			new TB_ElectronicTicketStateRecord.MustProperties() {
				/** 类型 */
				@Override public bairui.international.model.type.Type_StateRecord getType(){
					return bairui.international.model.type.Type_StateRecord.Flow;
				}
				/** 说明 */
				@Override public String getCommentate(){
					return Generator.generate(0, 255);
				}
				/** 电子券 */
				@Override public bairui.international.model.domain.jpa.TB_ElectronicTicket getElectronicTicket(){
					return electronicTicket;
				}
			},
			new TB_ElectronicTicketStateRecord.OptionalSingleProperties() {
				/** 消息 */
				@Override public String getMessage(){
					return Generator.generate(0, 255);
				}
			}
		);
	}
	

}
